const cloud = require('wx-server-sdk');
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database()

exports.main = async (event, context) => {
  return await db.collection('user_activity').aggregate()
        .match({ // 对主表user_activity 添加筛选条件
            user_id: event.user_id
        }) //选择我的活动表
        .lookup({
      from: 'activity',
    localField: 'activity_id',
    foreignField: '_id',
    as: 'activityList',
        }).end({
            success: function (res) {
                return res;
            },
            fail(error) {
                return error;
            }
        })
};